[verify] #268 test fails without fix (do not merge)#269
Closed
yahonda wants to merge 1 commit intorsim:masterfrom
Closed
[verify] #268 test fails without fix (do not merge)#269yahonda wants to merge 1 commit intorsim:masterfrom
yahonda wants to merge 1 commit intorsim:masterfrom
Conversation
Capture deprecation warnings emitted while resolving plsql.default_timezone with `activerecord_class` set, and assert that no warning mentioning `default_timezone` was raised. The test_gemfiles workflow exercises every supported ActiveRecord version (5.0 through 8.0), so this test will catch any future regression that re-introduces a call to the deprecated per-class `default_timezone` accessor on AR 7.0/7.1. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
Verified — AR 7.0 fails on the new test in schema_spec.rb:221 with the exact deprecation message from #234. The test correctly catches the bug. Closing without merging. |
3 tasks
yahonda
added a commit
to yahonda/ruby-plsql
that referenced
this pull request
Apr 14, 2026
Calling `ar_class.default_timezone` on Rails 7.0.x prints DEPRECATION WARNING: ActiveRecord::Base.default_timezone is deprecated and will be removed in Rails 7.1. Use ActiveRecord.default_timezone instead. even though both accessors return the same value. The per-class accessor was introduced as a deprecated proxy in Rails 7.0 (rails/rails@c3f43075a3) and removed entirely in Rails 7.1 (rails/rails@96c9db1b48), so the warning only fires on Rails 7.0.x. Switch the order in PLSQL::Schema#default_timezone so that we ask the module-level ActiveRecord.default_timezone first when it is available (AR 7.0+) and only fall back to the per-class accessor on pre-7.0 AR where the module-level one does not exist. This silences the warning on Rails 7.0.x and is a no-op on Rails 7.1+ (where the per-class accessor was already gone) and on Rails <= 6.x (where the module-level accessor did not yet exist). Add a regression test that captures deprecator output while resolving plsql.default_timezone with `activerecord_class` set, and asserts that no warning mentioning default_timezone was raised. The existing ActiveRecord.default_timezone is captured before assignment and restored from the ensure block alongside the deprecator behavior so the test is order-independent. Verified by rsim#269 / rsim#271 that the test fails on AR 7.0 without this fix and passes on AR 7.1+ regardless. Fixes rsim#234 References: - rails/rails@c3f43075a3 (added the deprecated delegators in Rails 7.0) - rails/rails@96c9db1b48 (removed them in Rails 7.1) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Do not merge. Temporary draft PR to confirm that the regression test added in #268 actually catches the bug from #234.
This branch contains only the test from #268 (without the fix in
lib/plsql/schema.rb). Expectation:test_gemfilesmatrix entries for AR 7.0 / 7.1 should fail (they hit the deprecation warning).skip(noActiveRecord.default_timezone=).Once observed, this PR will be closed.